C-CDA to FHIR System API - Implementation Template
Developer guide
This document provides information generated from the DataWeave scripts included in the project, such as function definitions, variable definitions, and data mapping tables. It can be used by developers seeking a solution to convert C-CDA XML-based objects to FHIR R4 JSON.
C-CDA Document List
The table provided below includes the C-CDA document type (eg. Continuity of Care or CCD) and the corresponding CDA sections that can be reused across various FHIR conversion requirements.
Document | Description |
---|---|
Continuity Of Care | The Continuity of Care Document (CCD) represents a core data set of the most relevant administrative, demographic, and clinical information facts about a patient's healthcare, covering one or more healthcare encounters. Supported Sections: Allergies and Intolerances, Medications, Problem, Procedures, Results, Advanced Directives, Encounters, Family History, Functional Status, Immunization, Medical Equipment, Payers, Plan of Treatment, Social History, Vital Signs, Mental Status, Nutrition |
Discharge Summary | The Discharge Summary is a document which synopsizes a patient's admission to a hospital, LTPAC provider, or other setting. It provides information for the continuation of care following discharge. Supported Sections: Allergies and Intolerances, Discharge Diagnosis, Discharge Medications, Plan of Treatment, Nutrition, Family History, Functional Status, Admission Diagnosis, Admission Medications, Immunization, Problem, Procedures, Social History, Vital Signs |
Consultation Note | The Consultation Note is generated by a request from a clinician for an opinion or advice from another clinician. Consultations may involve face-to-face time with the patient or may fall under the auspices of telemedicine visits. Supported Sections: Allergies and Intolerances, Problem, Family History, Immunization, Medications, Procedures, Results, Social History, Vital Signs, Functional Status, Medical Equipment, Advanced Directives, Mental Status, Nutrition, Plan of Treatment |
History and Physical | A History and Physical (H&P) note is a medical report that documents the current and past conditions of the patient. It contains essential information that helps determine an individual’s health status. Supported Sections: Allergies and Intolerances, Family History, Medications, Results, Social History, Vital Signs, Immunization, Problem, Procedures, Plan of Treatment, Advanced Directives |
Operative Note | The Operative Note is a frequently used type of procedure note with specific requirements set forth by regulatory agencies. The Operative Note is created immediately following a surgical or other high-risk procedure. Supported Sections: Procedure Anesthesia, Complications, Procedure Findings, Preoperative Diagnosis, Postoperative Diagnosis, Plan of Treatment |
Progress Note | Progress Note represents a patients clinical status during a hospitalization, outpatient visit, treatment with a LTPAC provider, or other healthcare encounter. It also defines as an ongoing record of a patient's illness and treatment. Supported Sections: Allergies and Intolerances, Medications, Problem, Results, Vital Signs, Nutrition, Plan of Treatment, Advanced Directives |
Procedure Note | A Procedure Note encompasses many types of non-operative procedures including interventional cardiology, gastrointestinal endoscopy, osteopathic manipulation, and many other specialty fields. Procedure Notes are differentiated from Operative Notes because they do not involve incision or excision as the primary act. Supported Sections: Allergies and Intolerances, Family History, Medications, Procedures, Social History, Complications, Postprocedure Diagnosis, Procedure Indications, Procedure Findings, Procedure Anesthesia |
Referral Note | A Referral Note communicates pertinent information from a provider who is requesting services of another provider of clinical or non-clinical services. The information in this document includes the reason for the referral and additional information that would augment decision making and care delivery. Supported Sections: Reason for Referral, Problem, Allergies and Intolerances, Medications, Family History, Immunization, Procedures, Results, Social History, Vital Signs, Functional Status, Medical Equipment, Advanced Directives, Mental Status, Nutrition |
Transfer Summary | The Transfer Summary standardizes critical information for exchange of information between providers of care when a patient moves between health care settings. Supported Sections: Advanced Directives, Allergies and Intolerances, Encounters, Family History, Functional Status, Discharge Diagnosis, Immunization, Medical Equipment, Medications, Payers, Plan of Treatment, Problem, Procedures, Results, Social History, Vital Signs, Mental Status, Nutrition, Admission Diagnosis, Admission Medications, Reason for Referral |
convertAdmissionDiagnosisToFHIR
Converts Admission Diagnosis section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Condition
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertAdmissionDiagnosisToFHIR.dwl
Functions
fun getCdaAdmissionDiagnosis (payload)
Gets a list of C-CDA admission diagnosis objects from the input payload.
param
payload
is the input XML CDA request.
return A list of C-CDA admission diagnosis objects or an empty list.
fun getCdaAdmissionDiagnosisEntries (cdaAdmissionDiagnosis)
Gets a filtered list of C-CDA admission diagnostic entries.
param
cdaAdmissionDiagnosis
is a list of C-CDA entries.
return A filtered list of C-CDA admission diagnosis entries or an empty list.
fun buildAdmissionDiagnosisObservations (cdaAdmissionDiagnosisEntries, patientId, practitionersList)
Builds a list of admission diagnosis FHIR Observation objects.
param
cdaAdmissionDiagnosisEntries
is a filtered list of C-CDA admission diagnosis entries.
parampatientId
is a string with the patient ID.
parampractitionersList
is a list of practitioners set as vars.practitionersList.
convertAdmissionMedicationsToFHIR
Converts Admission Medications section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Medication
MedicationRequest
MedicationDispense
MedicationStatement
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertAdmissionMedicationsToFHIR.dwl
Functions
fun getCdaMedicationSections (payload)
Gets a list of C-CDA medication sections from the input payload.
param
payload
is the input XML CDA request.
return A list of C-CDA medication sections or an empty list.
fun buildMedication (cdaMedicationSections)
Builds a list of FHIR formatted Medication objects.
param
cdaMedicationSections
is a list of C-CDA medication sections.
return A FHIR formatted list of Medication objects or an empty list.
fun buildMedicationRequest (cdaMedicationSections, patientId, practitionersList)
Builds a list of FHIR formatted MedicationRequest objects.
param
cdaMedicationSections
is a list of C-CDA medication sections.
parampatientId
is a string with the patient ID.
parampractitionersList
is a list of Practitioners set in the vars.practitionersList variable.
return A FHIR formatted list of MedicationRequest objects or an empty list.
fun buildMedicationDispence (cdaMedicationSections, patientId, medicationRequest, practitionersList)
Builds a list of FHIR formatted MedicationDispence objects.
param
cdaMedicationSections
is a list of C-CDA medication sections.
parampatientId
is a string with the patient ID.
parammedicationRequest
is a list of FHIR formatted MedicationRequest objects.
parampractitionersList
is a list of Practitioners set in the vars.practitionersList variable.
return A FHIR formatted list of MedicationDispence objects or an empty list.
fun buildMedicationStatement (cdaMedicationSections, patientId, medicationRequest, medicationDispense)
Builds a list of FHIR formatted MedicationStatement objects.
param
cdaMedicationSections
is a list of C-CDA medication sections.
parampatientId
is a string with the patient ID.
parammedicationRequest
is a list of FHIR formatted MedicationRequest objects.
parammedicationDispense
is a list of FHIR formatted MedicationDispense objects.
return A FHIR formatted list of MedicationStatement objects or an empty list.
convertAdvancedDirectiveToFHIR
Converts Advanced Directives section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Consent
DocumentReference
Practitioner
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertAdvancedDirectiveToFHIR.dwl
convertAllergyIntoleranceToFHIR
Converts Allergy Intolerance section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
AllergyIntolerance
ClinicalImpression
Practitioner
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertAllergyIntoleranceToFHIR.dwl
Functions
fun buildClinicalImpressions (clinicalImpressions, patientId, practitionersList, allergyList)
Builds the ClinicalImpression FHIR objects and returns them as a list.
param
clinicalImpressions
is a list of clinical impression C-CDA objects.
parampatientId
is a string with the patient ID.
parampractitionersList
is a list of the C-CDA practitioners.
paramallergyList
is a list of FHIR formatted AllergyIntolerance objects.
return A list of FHIR formatted ClinicalImpressions objects.
fun buildAllergies (clinicalImpressions, patientId, practitionersList)
Builds the allergy FHIR objects and returns them as a list.
param
clinicalImpressions
is a list of clinical impression C-CDA objects.
parampatientId
is a string with the patient ID.
parampractitionersList
is a list of the C-CDA practitioners.
return A list of FHIR formatted AllergyIntolerance objects.
fun getAllergies (ClinicalImpressions)
Gets a list of allergy objects with the provided list of clinical impressions. Uses getEntryRelationshipResource function from cdaToFHIRTools
param
ClinicalImpressions
is a list of clinical impression objects.
return A list of allergy objects or empty list.
fun getClinicalImpressions (payload)
Gets the clinical impressions with the provided payload. Uses getEntrySection function from cdaToFHIRTools
param
payload
is the input XML CDA request.
return A list of clinical impressions or an empty list.
convertComplicationToFHIR
Converts Complication section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Condition
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertComplicationToFHIR.dwl
Functions
fun getComplicationSection (payload)
Gets a list of C-CDA complication objects.
param
payload
is the input XML CDA request.
return A list of C-CDA complication objects or an empty list.
fun getComplicationEntries (complicationSection)
Gets a filtered list of C-CDA complication entries.
param
complicationSection
is a list of C-CDA complication objects.
return A filtered list of C-CDA complication entries.
fun buildComplicationConditions (complicationEntries, patientId, practitionersList)
Builds a list of FHIR formatted Condition objects.
param
complicationEntries
is a filtered list of C-CDA complication entries.
parampatientId
is a string with the patient ID.
parampractitionersList
is a list of practitioners set as vars.practitionersList.
return A list of FHIR formatted Condition objects or an empty list.
convertDischargeDiagnosisToFHIR
Converts Discharge Diagnosis section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Condition
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertDischargeDiagnosisToFHIR.dwl
Functions
fun getCdaDischargeDiagnosis (payload)
Gets a list of C-CDA discharge diagnosis objects.
param
payload
is the input XML CDA request.
return A list of C-CDA discharge diagnosis objects or an empty list.
fun getCdaDischargeDiagnosisEntries (cdaDischargeDiagnosis)
Gets a filtered list of C-CDA discharge diagnosis entries.
param
cdaDischargeDiagnosis
is a list of C-CDA discharge diagnosis objects.
return A filtered list of C-CDA discharge diagnosis entries.
fun buildDischargeDiagnosisCondition (cdaDischargeDiagnosisEntries, patientId, practitionersList)
Builds a list of FHIR formatted Condition objects.
param
cdaDischargeDiagnosisEntries
is a filtered list of C-CDA discharge diagnosis entries.
parampatientId
is a string with the patient ID.
parampractitionersList
is a list of practitioners set as vars.practitionersList.
return A list of FHIR formatted Condition objects or an empty list.
convertDischargeMedicationsToFHIR
Converts Discharge Medications section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Condition
Practitioner
Medication
MedicationDispense
MedicationAdministration
Organization
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertDischargeMedicationsToFHIR.dwl
Functions
fun getCdaMedications (payload)
Gets a list of C-CDA medication objects.
param
payload
is the input XML CDA request.
return A list of C-CDA medication objects or an empty list.
fun getCdaMedicationsEntries (cdaDischargeMedications)
Filters and returns a list of C-CDA medication entries.
param
cdaDischargeMedications
is a list of C-CDA medication objects to filter.
return A filtered list of C-CDA medication entries or an empty list.
fun buildDischargeOrganization (cdaDischargeMedicationsEntries)
Builds a list of FHIR formatted discharge Organization objects.
param
cdaDischargeMedicationsEntries
is a list of C-CDA discharge medication entries.
return A list of FHIR formatted Organization objects or an empty list.
fun buildDischargeMedication (cdaDischargeMedicationsEntries)
Builds a list of FHIR formatted discharge Medication objects.
param
cdaDischargeMedicationsEntries
is a list of C-CDA discharge medication entries.
return A list of FHIR formatted Medication objects or an empty list.
fun buildDischargeMedicationAdministration (cdaDischargeMedicationsEntries, patientId, dischargeMedicationIds)
Builds a list of FHIR formatted discharge MedicationAdministration objects.
param
cdaDischargeMedicationsEntries
is a list of C-CDA discharge medication entries.
parampatientId
is a string with the patient ID.
paramdischargeMedicationIds
is a list of discharge medication IDs.
return A list of FHIR formatted MedicationAdministration objects or an empty list.
fun buildDischargeMedicationCondition (cdaDischargeMedicationsEntries, patientId, practitionersList)
Builds a list of FHIR formatted discharge medication Condition objects.
param
cdaDischargeMedicationsEntries
is a list of C-CDA discharge medication entries.
parampatientId
is a string with the patient ID.
parampractitionersList
is a list of practitioners set as vars.practitionersList.
return A list of FHIR formatted medication Condition objects or an empty list.
fun buildDischargeMedicationDispensePractitioner (cdaDischargeMedicationsEntries)
Builds a list of FHIR formatted discharge medication dispense Practitioner objects.
param
cdaDischargeMedicationsEntries
is a list of C-CDA discharge medication entries.
return A list of FHIR formatted discharge medication dispense Practitioner objects or an empty list.
fun buildDischargeMedicationDispense (cdaDischargeMedicationsEntries, patientId, dischargeMedicationIds, dischargeMedicationDispensePractitionersIds)
Builds a list of FHIR formatted discharge MedicationDispense objects.
param
cdaDischargeMedicationsEntries
is a list of C-CDA discharge medication entries.
parampatientId
is a string with the patient ID.
paramdischargeMedicationIds
is a list of discharge medication IDs.
paramdischargeMedicationDispensePractitionersIds
is a list of discharge medication dispense practitioner IDs.
return A list of FHIR formatted discharge MedicationDispense objects or an empty list.
convertEncounterToFHIR
Converts Encounters section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Practitioner
Encounter
Location
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertEncounterToFHIR.dwl
Functions
fun getEncounters (payload)
Gets a list of C-CDA encounter objects with the provided payload.
param
payload
is the input CDA XML request.
return A list of C-CDA encounter objects or an empty array.
fun buildLocations (cdaEncounters)
Builds a list of FHIR formatted Location objects with the provided list of encounters and location ID.
param
cdaEncounters
is a list of C-CDA encounter objects.
return A list of FHIR formatted Location objects or a blank list.
fun buildEncounters (cdaEncounters, patientId, locId, practitionerList)
Builds a list of FHIR formatted Encounter objects with the provided arguments.
param
cdaEncounters
is a list of C-CDA encounter objects.
parampatientId
is a string with the patient ID.
paramlocId
is a string with the location ID.
parampractitionersList
is a list of practitioners.
return a list of FHIR formatted Encounter objects or an empty list.
convertFamilyHistoryToFHIR
Converts Family History section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
FamilyHistory
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertFamilyHistoryToFHIR.dwl
Functions
fun buildFamilyHistory (familyHistoryList, fhirFamHistConstants, patientId)
Function to build a list of FamilyHistory FHIR R4 resources using input C-CDA Family History section. Uses getEntrySection from cdaToFHIRTools.
param
familyHistoryList
is a list of family history organizer objects.
paramfhirFamHistConstants
is a list of constants used to in FHIR R4 mapping.
parampatientId
is the id of the patient.
return An array of FHIR R4 FamilyHistory resources.
convertFunctionalStatusToFHIR
Converts Functional Status section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Observation
DeviceUseStatement
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertFunctionalStatusToFHIR.dwl
Functions
fun getCdaFunctionalStatus (payload)
Gets a list of C-CDA functional status objects with the provided payload.
param
payload
is the input XML CDA request.
return A list of C-CDA functional status objects or an empty list.
fun getCdaFunctionalStatusOrganizer (cdaFunctionalStatus)
Gets a list of C-CDA functional status organizer objects with the provided list of C-CDA functional status objects.
param
cdaFunctionalStatus
is a list of C-CDA functional status objects.
return A list of C-CDA functional status organizer objects or empty list.
fun buildFunctionalObservations (functionalStatusOrganizer, patientId, perfRefList)
Builds a list of FHIR functional Observation objects with the provided functional status organizer list and patient ID.
param
functionalStatusOrganizer
is a C-CDA functional status organizer list of objects.
parampatientId
is a string with the patient ID.
return A list of FHIR formatted Observation objects or an empty list.
fun buildSelfCareObservations (functionalStatusOrganizer, patientId, perfRefList)
Builds a list of FHIR self care Observation objects with the provided functional status organizer list and patient ID.
param
functionalStatusOrganizer
is a C-CDA functional status organizer list of objects.
parampatientId
is a string with the patient ID.
return A list of FHIR formatted Observation objects or an empty list.
fun buildSensoryObservations (cdaFunctionalStatus, patientId, perfRefList)
Builds a list of FHIR sensory Observation objects with the provided functional status list and patient ID.
param
cdaFunctionalStatus
is a C-CDA functional status list of objects.
parampatientId
is a string with the patient ID.
return A list of FHIR formatted Observation objects or an empty list.
fun buildAssessmentScaleObservations (cdaFunctionalStatus, patientId, perfRefList)
Builds a list of FHIR assessment scale Observation objects with the provided functional status list and patient ID.
param
cdaFunctionalStatus
is a C-CDA functional status list of objects.
parampatientId
is a string with the patient ID.
return A list of FHIR formatted Observation objects or an empty list.
fun buildProblemObservations (cdaFunctionalStatus, patientId, perfRefList)
Builds a list of FHIR problem Observation objects with the provided functional status list and patient ID.
param
cdaFunctionalStatus
is a C-CDA functional status list of objects.
parampatientId
is a string with the patient ID.
return A list of FHIR formatted Observation objects or an empty list.
fun buildNonMedDeviceSupply (cdaFunctionalStatus, patientId)
Builds a list of FHIR non medical device supply DeviceUseStatment objects with the provided functional status list and patient ID.
param
cdaFunctionalStatus
is a C-CDA functional status list of objects.
parampatientId
is a string with the patient ID.
return A list of FHIR formatted Observation objects or an empty list.
fun buildCareGiverCharObservations (cdaFunctionalStatus, patientId, perfRefList)
Builds a list of FHIR care giver Observation objects with the provided functional status list and patient ID.
param
cdaFunctionalStatus
is a C-CDA functional status list of objects.
parampatientId
is a string with the patient ID.
return A list of FHIR formatted Observation objects or an empty list.
convertImmunizationToFHIR
Converts Immunization section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Practitioner
Immunization
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertImmunizationToFHIR.dwl
Functions
fun getCdaImmunizations (payload)
Gets a list of C-CDA immunization objects with the provided payload.
param
payload
is the input XML CDA request.
return A list of C-CDA immunization objects or an empty array.
fun buildImmunizations (cdaImmunizations, patientId, performersList)
Builds a list of FHIR formatted Immunization objects with the provided list of C-CDA immunization objects.
param
cdaImmunizations
is a list of C-CDA immunization objects.
parampatientId
is a string with the patient ID.
paramperformersList
is the list of performers.
return A list of FHIR formatted Immunization objects or an empty list.
convertMedicalEquipmentToFHIR
Converts Medical Equipment section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Practitioner
Device
Organization
Procedure
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertMedicalEquipmentToFHIR.dwl
Functions
fun buildMedicalEquipment (payload, templateId)
Build the MedicalEquipment Section FHIR objects and returns them as a list.
param
payload
is input XML CDA request.
paramtemplateId
is the Template ID.
return A list of MedicalEquipment Section or an empty list.
fun buildMedicalEquipmentOrganizer (medicalEquipment, templateId)
Build the MedicalEquipmentOrganizer FHIR objects and returns them as a list.
param
medicalEquipment
is a list of MedicalEquipment C-CDA objects.
paramtemplateId
is the Template ID.
return A list of MedicalEquipmentOrganizer list or an empty list.
fun buildNonMedicalSupply (medicalEquipment, templateId)
Build the NonMedicalSupply FHIR objects and returns them as a list.
param
medicalEquipment
is a list of MedicalEquipment C-CDA objects.
paramtemplateId
is the Template ID.
return A list of NonMedicalSupply list or an empty list.
fun buildSupplyResources (medicalEquipmentOrganizer, nonMedicalSupply)
Build the SupplyResources FHIR objects and returns them as a list.
param
medicalEquipmentOrganizer
is a list of medicalEquipmentOrganizer C-CDA objects.
paramnonMedicalSupply
is a list of nonMedicalSupply C-CDA objects.
return A list of SupplyResources list or an empty list.
fun buildDeviceList (supplyResources)
Build the DeviceIds FHIR objects and returns them as a list.
param
supplyResources
is a list of Supply Resources C-CDA objects.
return A list of Device list or an empty list.
fun buildMedicalEquipProcedureList (medicalEquipment)
Build the MedicalEquipProcedure list FHIR objects and returns them as a list.
param
medicalEquipment
is a list of Supply Resources C-CDA objects.
return A list of MedicalEquipProcedure list or an empty list.
fun buildMedEquipPerformers (medicalEquipProcedureList)
Build the MedEquipPerformers list FHIR objects and returns them as a list.
param
medicalEquipProcedureList
is a list of Supply Resources C-CDA objects.
return A list of MedEquipPerformers list or an empty list.
fun buildMedEquipPerformersList (medEquipPerformers)
Build the MedEquipPerformers list FHIR objects and returns them as a list.
param
medEquipPerformers
is a list of Supply Resources C-CDA objects.
return A list of MedEquipPerformers list or an empty list.
fun buildMedEquipProcedure (medicalEquipProcedureList)
Build the Medical Equipment Procedure list FHIR objects and returns them as a list.
param
medicalEquipProcedureList
is a list of Supply Resources C-CDA objects.
return A list of Medical Equipment Procedure list or an empty list.
convertMedicationSectionToFHIR
Converts Medications section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Medication
MedicationRequest
MedicationDispense
MedicationStatement
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertMedicationSectionToFHIR.dwl
Functions
fun getCdaMedicationSections (payload)
Gets a list of C-CDA medication sections.
param
payload
is the input XML CDA request.
return A list of C-CDA medication sections or an empty list.
fun buildMedication (cdaMedicationSections)
Builds a FHIR formatted list of Medication objects.
param
cdaMedicationSections
is a list of C-CDA medication objects.
return A FHIR formatted list of Medication objects or an empty list.
fun buildMedicationRequest (cdaMedicationSections, patientId, practitionersList)
Builds a list of FHIR formatted MedicationRequest objects.
param
cdaMedicationSections
is a list of C-CDA medication sections.
parampatientId
is a string with the patient ID.
parampractitionersList
is a list of Practitioners set in the vars.practitionersList variable.
return A FHIR formatted list of MedicationRequest objects or an empty list.
fun buildMedicationDispense (cdaMedicationSections, patientId, medicationRequest, practitionersList)
Builds a list of FHIR formatted MedicationDispence objects.
param
cdaMedicationSections
is a list of C-CDA medication sections.
parampatientId
is a string with the patient ID.
parammedicationRequest
is a list of FHIR formatted MedicationRequest objects.
parampractitionersList
is a list of Practitioners set in the vars.practitionersList variable.
return A FHIR formatted list of MedicationDispence objects or an empty list.
fun buildMedicationStatement (cdaMedicationSections, patientId, medicationRequest, medicationDispense)
Builds a list of FHIR formatted MedicationStatement objects.
param
cdaMedicationSections
is a list of C-CDA medication sections.
parampatientId
is a string with the patient ID.
parammedicationRequest
is a list of FHIR formatted MedicationRequest objects.
parammedicationDispense
is a list of FHIR formatted MedicationDispense objects.
return A FHIR formatted list of MedicationStatement objects or an empty list.
convertMentalHealthToFHIR
Converts Mental Health section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Observation
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertMentalHealthToFHIR.dwl
Functions
fun getCdaMentalStatusEntries (payload)
Gets a list of C-CDA mental status entries objects with the provided payload.
param
payload
is the input XML CDA request.
return A list of C-CDA mental status entries objects or an empty list.
fun getCdaAssessmentObservations (cdaMentalStatusEntries)
Gets a list of C-CDA assessment observation objects with the provided payload.
param
cdaMentalStatusEntries
is a list of C-CDA mental status entries.
return A list of C-CDA assessment observation objects or an empty list.
fun buildAssessmentObservation (cdaAssessmentObservations, patientId, perfRefList)
Builds a list of FHIR formatted assessment Observation objects.
param
cdaAssessmentObservations
is a list of C-CDA assessment observation objects.
parampatientId
is a string with the patient ID.
return A list of FHIR formatted assessment Observation objects or an empty list.
fun getCdaMentalStatusObservations (cdaMentalStatusEntries)
Gets a list of C-CDA mental status observation objects with the provided payload.
param
cdaMentalStatusEntries
is a list of C-CDA mental status entries.
return A list of C-CDA mental status observation objects or an empty list.
fun buildMentalStatusObservation (cdaMentalStatusObservations, patientId, perfRefList)
Builds a list of FHIR formatted mental status Observation objects.
param
cdaMentalStatusObservations
is a list of C-CDA mental status observation objects.
parampatientId
is a string with the patient ID.
return A list of FHIR formatted mental status Observation objects or an empty list.
convertNutritionToFHIR
Converts Nutrition section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Observation
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertNutritionToFHIR.dwl
Functions
fun getCdaNutritionSections (payload)
Gets a list of C-CDA nutrition section objects.
param
payload
is the input XML CDA request.
return A list of C-CDA nutrition section objects or an empty list.
fun getCdaNutritionObservations (cdaNutritionSections)
Gets a list of C-CDA nutrition observation objects.
param
cdaNutritionSections
is a list of C-CDA nutrition section objects.
return A list of C-CDA nutrition observation objects or an empty list.
fun getCdaNutritionAssessments (cdaNutritionObservations)
Gets a list of C-CDA nutrition assessment objects.
param
cdaNutritionSections
is a list of C-CDA nutrition section objects.
return A list of C-CDA nutrition assessment objects or an empty array.
fun buildNutritionObservations (cdaNutritionAssessments, patientId, perfRefList)
Gets a list of FHIR formatted nutrition Observation objects with the provided C-CDA nutrition assessments.
param
cdaNutritionAssessments
is a list of C-CDA nutrition assessment objects.
parampatientId
is a string with the patient ID.
return A list of FHIR formatted nutrition Observation objects or an empty list.
convertPayerToFHIR
Converts Payers section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Organization
Coverage
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertPayerToFHIR.dwl
Functions
fun getPayersSection (payload)
Gets payer org and from within that, fetch payers and coverage with the provided payload.
param
payload
is the input XML CDA request.
return A array of payers and coverage or empty array.
fun getCoverage (payersSection)
Gets the coverage with the payer org.
param
payersSection
is payers and coverage with the provided payload.
return A list of coverage or an empty list.
fun getPolicy (coverage)
Gets the policy with the payer org.
param
coverage
is policy that covers in payer org.
return A list of coverage or an empty list.
fun buildPayers (payersSection)
Creates the list of organizations with the payer org.
param
payersSection
is payers and coverage with the provided payload.
return A list of organizations or an empty list.
fun buildPolicy (policy)
Creates the list of coverage with the payer org.
param
payersSection
is payers and coverage with the provided payload.
return A list of coverage or an empty list.
fun getPayerIds (payers)
Gets the payer id's with the payer org.
param
payers
is list of payers in payer org.
return A list of payer id's or empty list.
convertPlanOfTreatmentToFHIR
Converts Plan of Treatment section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Practitioner
Goal
ServiceRequest
MedicationRequest
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertPlanOfTreatmentToFHIR.dwl
Variables
var planSection
Filter payload to fetch various plan section subsets.
Functions
fun getPlanSectionAuthors (plannedObsrv, plannedEncounter, planActs, planProcs, planMedAct, planSupply, planImmAct, planNutritionSect, planGoalObsrv)
Function to extract authors from all planed action sections.
param
plannedObsrv
is the list of planned observation.
paramplannedEncounter
is the list of planned encounters.
paramplanActs
is the list of planned acts.
paramplanProcs
is the list of planned procedures.
paramplanMedAct
is the list of planned medication activity.
paramplanSupply
is the list of planned supply.
paramplanImmAct
is the list of planned immunization activity.
paramplanNutritionSect
is the list of planned nutrition recommendation.
paramplanGoalObsrv
is the list of planned goal observation.
fun buildServRequests (servList, fhirServConstants, patientId, refList)
Function to build FHIR R4 Service Requests from Plan of Treatment Section. Uses createServiceRequest function.
param
servList
is a list of C-CDA format service requests.
paramfhirServConstants
is a list of constants used for mapping.
parampatientId
is the patient's Id.
paramrefList
is a list of practitioner references for author mapping.
return An array of FHIR formatted Service Requests List.
fun buildPlannedMedicationRequests (medReqList, fhirMedConstants, patientId, refList)
Function to build FHIR R4 Planned Medication Requests from Plan of Treatment Section. Uses createServiceRequest function.
param
medReqList
is a list of C-CDA format Planned Medication requests.
paramfhirServConstants
is a list of constants used for mapping.
parampatientId
is the patient's Id.
paramrefList
is a list of practitioner references for author mapping.
return An array of FHIR formatted Planned Medication Requests List.
fun buildGoal (goalReqs, patientId)
Function to build FHIR R4 Goal Requests from Plan of Treatment Section. Uses createServiceRequest function.
param
goalReqs
is a list of C-CDA format Goal requests.
parampatientId
is the patient's Id.
return An array of FHIR formatted Goal objects List.
convertPostOperativeDiagnosisToFHIR
Converts PostoperativeDiagnosis section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Condition
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertPostOperativeDiagnosisToFHIR.dwl
Functions
fun getPostoperativeDiagnosisSection (payload)
Gets a list of C-CDA PostoperativeDiagnosis objects.
param
payload
is the input XML CDA request.
return A list of CDA PostoperativeDiagnosis objects or an empty list.
fun getPostoperativeDiagnosisActEntries (postoperativeDiagnosisSection)
Gets a filtered list of C-CDA PostoperativeDiagnosis entries.
param
postoperativeDiagnosisSection
is a list of C-CDA PostoperativeDiagnosis objects.
return A filtered list of C-CDA PostoperativeDiagnosis entries.
fun getPostoperativeDiagnosisObservations (postoperativeDiagnosisActEntries)
Gets a filtered list of C-CDA PostoperativeDiagnosis observations.
param
postoperativeDiagnosisActEntries
is a list of C-CDA PostoperativeDiagnosis entries.
return A filtered list of C-CDA PostoperativeDiagnosis observations objects.
fun buildPostoperativeDiagnosisConditions (postoperativeDiagnosisObservations, patientId, practitionersList)
Builds a list of FHIR formatted PostoperativeDiagnosis Condition objects.
param
postoperativeDiagnosisObservations
is a filtered list of C-CDA PostoperativeDiagnosis observation objects.
parampatientId
is a string with the patient ID.
parampractitionersList
is a list of practitioners set as vars.practitionersList.
return A list of FHIR formatted Condition objects or an empty list.
convertPostPostprocedureDiagnosis
Converts Postprocedure Diagnosis section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Condition
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertPostPostprocedureDiagnosis.dwl
Functions
fun getPostprocedureDiagnosisSection (payload)
Gets a list of C-CDA Postprocedure Diagnosis objects.
param
payload
is the input XML CDA request.
return A list of C-CDA PostprocedureDiagnosis objects or an empty list.
fun getPostprocedureDiagnosisEntries (postprocedureDiagnosisSection)
Gets a filtered list of C-CDA Postprocedure Diagnosis entries.
param
postprocedureDiagnosisSection
is a list of C-CDA PostprocedureDiagnosis objects.
return A filtered list of C-CDA PostprocedureDiagnosis entries.
fun buildPostprocedureDiagnosisConditions (postprocedureDiagnosisEntries, patientId, practitionersList)
Builds a list of FHIR formatted Postprocedure Diagnosis Condition objects.
param
postprocedureDiagnosisEntries
is a filtered list of C-CDA PostprocedureDiagnosis entries.
parampatientId
is a string with the patient ID.
parampractitionersList
is a list of practitioners set as vars.practitionersList.
return A list of FHIR formatted Condition objects or an empty list.
convertPreoperativeDiagnosisToFHIR
Converts PreoperativeDiagnosis section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Condition
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertPreoperativeDiagnosisToFHIR.dwl
Functions
fun getPreoperativeDiagnosisSection (payload)
Gets a list of C-CDA PreoperativeDiagnosis objects.
param
payload
is the input XML CDA request.
return A list of C-CDA PreoperativeDiagnosis objects or an empty list.
fun getPreoperativeDiagnosisActEntries (preoperativeDiagnosisSection)
Gets a filtered list of C-CDA PreoperativeDiagnosis entries.
param
preoperativeDiagnosisSection
is a list of C-CDA PreoperativeDiagnosis objects.
return A filtered list of C-CDA PreoperativeDiagnosis entries.
fun getPreoperativeDiagnosisObservations (preoperativeDiagnosisActEntries)
Gets a filtered list of C-CDA PreoperativeDiagnosis observations.
param
preoperativeDiagnosisActEntries
is a list of C-CDA PreoperativeDiagnosis entries.
return A filtered list of C-CDA PreoperativeDiagnosis observations objects.
fun buildPreoperativeDiagnosisConditions (preoperativeDiagnosisObservations, patientId, practitionersList)
Builds a list of FHIR formatted PreoperativeDiagnosis Condition objects.
param
preoperativeDiagnosisObservations
is a filtered list of C-CDA PreoperativeDiagnosis observation objects.
parampatientId
is a string with the patient ID.
parampractitionersList
is a list of practitioners set as vars.practitionersList.
return A list of FHIR formatted Condition objects or an empty list.
convertProblemToFHIR
Converts Problems section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Condition
ClinicalImpression
Practitioner
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertProblemToFHIR.dwl
Functions
fun buildConditions (problemConcerns, conditionTemplateId, resourceType, fhirProblemConstants, perfRefList)
Function to build condition FHIR resources using the input C-CDA Observations. Uses function getEntryRelationshipResource to fetch the C-CDA observations list, which is then mapped to FHIR R4 Condition.
param
problemConcerns
is a list of C-CDA "act" resource.
paramconditionTemplateId
is the C-CDA templateId for Conditions.
paramresourceType
is the type of object to be selected for Condition. Example: observation.
paramfhirProblemConstants
is a list of constants used for mapping.
fun buildClinicalImpressions (problemsList, patientId, practList, conditionsList, impressionType)
Function to build condition FHIR resources using the input C-CDA's Act. Uses createClinicalImpression function from cdaToFHIRTools.
param
problemList
is the list of C-CDA "act" from the input.
parampatientId
identifies the id of patient to be used for reference.
convertProcedureAnesthesiaToFHIR
Converts ProcedureAnesthesia section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Organization
Practitioner
Procedure
Observation
Medication
MedicationAdministration
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertProcedureAnesthesiaToFHIR.dwl
Functions
fun buildProcedureAnesthesiaSection (payload, templateId)
Build the Procedure Anesthesia Section FHIR objects and returns them as a list.
param
payload
is the input XML CDA request.
paramtemplateId
is the Template ID.
return A list of Procedure Anesthesia Section or an empty list.
fun buildProcedureEntries (procedureAnesthesiaSection, templateId)
Build the Procedure Activity Section FHIR objects and returns them as a list.
param
procedureAnesthesiaSection
is a list of C-CDA objects.
paramtemplateId
is the Template ID.
return A list of Procedure objects or an empty list.
fun buildMedicationEntries (procedureAnesthesiaSection, templateId)
Build the Medication Section FHIR objects and returns them as a list.
param
procedureAnesthesiaSection
is a list of C-CDA Medication section objects.
paramtemplateId
is the Template ID.
return A list of Medication objects or an empty list.
fun buildRepresentedOrganization (performers)
Build the represented organization FHIR objects and returns them as a list.
param
performers
is a list of C-CDA objects.
return A list of procedure observation or an empty list.
fun buildProceduresList (procedureEntries)
Build the procedures FHIR objects and returns them as a list.
param
procedureEntries
is a list of C-CDA procedure entries.
return A list of procedure or an empty list.
fun buildMedicationAdministration (medicationEntries, patientId, medicationIds)
Builds a list of FHIR formatted MedicationAdministration objects.
param
medicationEntries
is a list of C-CDA medication entries.
parampatientId
is a string with the patient ID.
parammedicationIds
is a list of medication IDs.
return A list of FHIR formatted MedicationAdministration objects or an empty list.
fun buildMedications (medicationEntries)
Builds a list of FHIR formatted Medication objects.
param
medicationEntries
is a list of C-CDA medication entries.
return A list of FHIR formatted Medication objects or an empty list.
convertProcedureFindingToFHIR
Converts ProcedureFinding section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Condition
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertProcedureFindingToFHIR.dwl
Functions
fun getProcedureFindingSection (payload)
Gets a list of C-CDA ProcedureFinding objects.
param
payload
is the input XML CDA request.
return A list of C-CDA ProcedureFinding objects or an empty list.
fun getProcedureFindingEntries (procedureFindingSection)
Gets a filtered list of C-CDA ProcedureFinding entries.
param
procedureFindingSection
is a list of C-CDA ProcedureFinding objects.
return A filtered list of C-CDA ProcedureFinding entries.
fun buildProcedureFindingConditions (procedureFindingEntries, patientId, practitionersList)
Builds a list of FHIR formatted ProcedureFinding Condition objects.
param
procedureFindingEntries
is a filtered list of C-CDA ProcedureFinding entries.
parampatientId
is a string with the patient ID.
parampractitionersList
is a list of practitioners set as vars.practitionersList.
return A list of FHIR formatted Condition objects or an empty list.
convertProcedureIndications
Converts Procedure Indications section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Observation
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertProcedureIndications.dwl
Functions
fun buildProcedureIndicationsSection (payload, templateId)
Build the Procedure Indications Section FHIR objects and returns them as a list.
param
payload
is input XML CDA request.
paramtemplateId
is the Template ID.
return A list of Procedure Indications or an empty list.
fun buildProcedureIndicationsObservations (procedureIndications, templateId)
Build the Procedure Indications Observations FHIR objects and returns them as a list.
param
socialHistory
is a list of Procedure Indications C-CDA objects.
paramtemplateId
is the Template ID.
return A list of Procedure Indications or an empty list.
convertProcedureToFHIR
Converts Procedures section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Organization
Practitioner
Procedure
Observation
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertProcedureToFHIR.dwl
Functions
fun buildProcedureSection (payload, templateId)
Build the Procedure Section FHIR objects and returns them as a list.
param
payload
is the input XML CDA request.
paramtemplateId
is the Template ID.
return A list of Procedure Section or an empty list.
fun buildProcedureActivityProcedure (procedureSection, templateId)
Build the Procedure Activity Section FHIR objects and returns them as a list.
param
procedureSection
is a list of C-CDA objects.
paramtemplateId
is the Template ID.
return A list of procedure activity or an empty list.
fun buildProcedureObservations (procedureSection, templateId)
Build the procedure observations FHIR objects and returns them as a list.
param
payload
is the input XML CDA request.
paramtemplateId
is the Template ID.
return A list of procedure observation or an empty list.
fun buildProcedureActs (procedureSection, templateId)
Build the procedure observations FHIR objects and returns them as a list.
param
procedureSection
is a list of C-CDA procedure section objects.
paramtemplateId
is the Template ID.
return A list of procedure observation or an empty list.
fun buildProceduresList (procedureActs, procedureActivityProcedure)
Build the procedures list FHIR objects and returns them as a list.
param
performers
is a list of C-CDA performers objects.
paramtemplateId
is the Template ID.
return A list of procedure or an empty list.
convertReasonforReferralToFHIR
Creates the Reason for Referral section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
ServiceRequest
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertReasonforReferralToFHIR.dwl
Functions
fun buildServRequests (servList, fhirServConstants, patientId, refList)
Function to build FHIR R4 Service Requests from Plan of Treatment Section. Uses createServiceRequest function.
param
servList
is a list of CDA format service requests.
paramfhirServConstants
is a list of constants used for mapping.
parampatientId
is the patient's Id.
paramrefList
is a list of practitioner references for author mapping.
return An array of FHIR formatted Service Requests List.
convertResultsToFHIR
Converts Results section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Observation
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertResultsToFHIR.dwl
Functions
fun buildDiagnosticReportSection (payload, templateId)
Build the Diagnostic Report Section FHIR objects and returns them as a list.
param
payload
is the input XML CDA request.
paramtemplateId
is the Template ID.
return A list of Diagnostic Report Section or an empty list.
fun buildDiagnosticObservations (diagnosticReport, templateId, perfRefList)
Build the Diagnostic Report Observations FHIR objects and returns them as a list.
param
diagnosticReport
is a list of Diagnostic Report C-CDA objects.
paramtemplateId
is the Template ID.
return A list of Social History or an empty list.
fun buildDiagnosticObservationIds (diagnosticObservations)
Build the Diagnostic Observations ID objects and returns them as a list.
param
diagnosticObservations
is a list of Diagnostic Report C-CDA objects.
paramtemplateId
is the Template ID.
return A list of Diagnostic Observation IDs or an empty list.
convertSocialHistoryToFHIR
Converts Social History section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Observation
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertSocialHistoryToFHIR.dwl
Functions
fun buildSocialHistorySection (payload, templateId)
Build the Social History Section FHIR objects and returns them as a list.
param
payload
is the input XML CDA request.
paramtemplateId
is the Template ID.
return A list of Social History Section or an empty list.
fun buildSocialHistoryObservations (socialHistory, templateId)
Build the Social History Observations FHIR objects and returns them as a list.
param
socialHistory
is a list of Social History C-CDA objects.
paramtemplateId
is the Template ID.
return A list of Social History or an empty list.
convertVitalSignsToFHIR
Converts Vital Signs section from C-CDA to FHIR R4 JSON.
Produces the following FHIR R4 Resources:
Observation
Source:
.src/main/resources/dwl/fhirUtil/cdaSection/convertVitalSignsToFHIR.dwl
Functions
fun buildVitalSignSection (payload, templateId)
Build the VitalSign Section FHIR objects and returns them as a list.
param
payload
is the input XML CDA request.
paramtemplateId
is the Template ID.
return A list of Vital Signs Section or an empty list.
fun buildVitalSignObservations (vitalSigns, templateId, perfRefList)
Build the VitalSign Observations FHIR objects and returns them as a list.
param
vitalSigns
is a list of Vital Signs C-CDA objects.
paramtemplateId
is the Template ID.
return A list of Vital Signs or an empty list.
createFHIRR4AllergyIntolerance
This module implements functions to support creation of FHIR R4 AllergyIntolerance.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4AllergyIntolerance.dwl
Functions
fun allergyIntoleranceCategoryLookUp (incode)
Function to lookup C-CDA AllergyIntolerance category type and fetch FHIR type.
param
incode
is C-CDA format code.
return A FHIR format code.
fun createAllergyIntolerance (allergy, fhirAllergyConstants, allergyId, patientId, practitionerList)
Function to create AllergyIntolerance FHIR object from the input XML CDA Request. Uses getIdentifier function from cdaToFHIRTools.
param
allergy
is a object from the CDA input XML, containing AllergyIntolerance information.
paramfhirAllergyConstants
is a list of constants to be used for mapping.
parampatientId
is the patient id.
paramallergyId
is id for the resource.
parampractitionerList
is a list of practitioner identifiers and IDs.
return A FHIR format AllergyIntolerance object.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
identifier.system | allergy.id | Identifier system for resource |
identifier.value | allergy.id | Identifier value for resource |
clinicalStatus.coding.system | Constant clinicalStatusSystem from fhirConstants.AllergyIntolerance | |
clinicalStatus.coding.code | allergy.effectiveTime | Use function getClinicalStatus to lookup code |
category | allergy.value.code | Use function allergyIntoleranceCategoryLookUp to lookup category |
recordedDate | allergy.author.time.value | Format datetime using function formatDateTime |
recorder.reference | allergy.author.assignedAuthor.id.extension | Lookup practitioner id from practitionerList |
code.coding.system | Constant codeCodeSystem from fhirConstants.AllergyIntolerance | |
code.coding.code | allergy.participant.participantRole.playingEntity.code.code | Allergy Intolerance Code |
code.coding.system | Constant codeCodeSystem from fhirConstants.AllergyIntolerance | |
code.coding.display | allergy.participant.participantRole.playingEntity.code.displayName | Allergy Intolerance Display Name |
patient.reference | patientId | Patient ID created from recordTarget |
reaction.onset | allergy.entryRelationship.observation.effectiveTime.low.value | Reaction Onset Time |
reaction.substance.coding.code | allergy.entryRelationship.observation.participant.participantRole.playingEntity.code.code | Allergy Substance code |
reaction.substance.coding.system | Constant codeCodeSystem from fhirConstants.AllergyIntolerance | |
reaction.substance.coding.display | allergy.entryRelationship.observation.participant.participantRole.playingEntity.code.displayName | Allergy Substance Code Name |
onsetDateTime | allergy.author.time.value | Format datetime using formatDateTime |
fun getClinicalStatus (effectivedate)
Gets the clinical status field with the provided effective date.
param
effectivedate
is an effective date object.
return A string with resolved, active, or inactive.
createFHIRR4ClinicalImpression
This module implements functions to support creation of FHIR R4 ClinicalImpression.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4ClinicalImpression.dwl
Functions
fun createClinicalImpression (clin, patientId, practList, clinId, refList, refType)
Function to create ClincalImpression FHIR object from the input XML CDA Request. Uses getIdentifier function from cdaToFHIRTools.
param
clin
is a object from the CDA input XML, containing ClincalImpression information.
paramfhirProblemConstants
is a list of constants to be used for mapping.
parampatientId
is the patient id.
paramclinId
is id for the resource.
parampractList
is a list of practitioner identifiers and IDs.
paramrefList
is a list of references.
paramrefType
is a literal of the reference type.
return A FHIR format ClincalImpression object.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
identifier.system | clin.id | Identifier system for resource |
identifier.value | clin.id | Identifier value for resource |
status | Constant "completed" | |
subject.reference | patientId | Patient ID created from recordTarget |
effectivePeriod.start | clin.effectiveTime.low.value | Clinical Impression Start Date |
effectivePeriod.end | clin.effectiveTime.high.value | Clinical Impression End Date |
performer.reference | clin.author.assignedAuthor.id.extension | Lookup practList using the extension for id |
problem.reference | clin.entryRelationship.observation.id.root | Lookup refList using entryRelationship.observation.id.root for problem reference |
createFHIRR4Composition
This module implements functions to support creation of FHIR R4 Composition.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Composition.dwl
Functions
fun createCompositionSection (resourceSection, resourceList, compConstants)
Function to create section array for composition.
param
resourceSection
is a object from the CDA input XML request, containing Clinical Document Resource information.
paramcompConstants
is a list of constants to be used for mapping.
paramresourceList
is a list of FHIR resources converted for the resourceSection.
return An array of section for Composition.
FHIRR4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
title | resourceSection.title | Id generated using uuid() for resource |
text.status | Constant "generated" | |
text.div | resourceSection.code.displayName or resourceSection.title | Concat with w3org url to create div |
code.coding.code | resourceSection.code.code | Composition Section Code |
code.coding.system | resourceSection.code.codeSystem | Use function mapCodeSystem to lookup code system |
mode | Constant compSectionMode from fhirConstants.Composition | |
status | Constant compStatus from fhirConstants.Composition | |
entry.reference | resourceList.resource.resourceType ++ resourceList.resource.id | Create an entry using resourceType and id |
entry.dispaly | resourceList.resource.code.coding.display | Resource name for section |
fun createCompositionHeader (compId, compHeader, compConstants, practList, patientId, custodianOrgId, encounterId, organizationsList)
Function to create FHIR object from incoming C-CDA Request. Uses getIdentifier function from cdaToFHIRTools.
param
compId
is ID for the resource.
paramcompHeader
is a object from the CDA input XML, containing Clinical Document header information.
paramcompConstants
is a list of constants to be used for mapping.
parampractList
is a list of practitioner identifiers and IDs.
parampatientId
is the patient ID.
paramcustodianOrgId
is the Custodian orgId.
paramencounterId
is the Encompassing encounter Id.
paramorganizationsList
is a list of organizations identifiers and IDs.
return - FHIR format Composition Header object.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | compHeader.setId.extension | ClinicalDocument.setId.extension is used as Composition Id |
identifier.system | Constant compIdentifierSystem from fhirConstants.Composition | |
identifier.value | uuid() | Identifier value for resource |
status | Constant compStatus from fhirConstants.Composition | |
type.coding.code | compHeader.code.code | Composition Header type code |
type.coding.dispaly | compHeader.code.displayName | Composition Header type name |
type.coding.system | compHeader.code.codeSystem | Use function mapCodeSystem to lookup code system |
date | resource.effectiveTime.value | Format datetime using function formatDateTime |
author.reference | compHeader.author.assignedAuthor.id.extension | Use parameter practList ++ organizationsList to identify author and organization |
title | compHeader.title | Composition title |
confidentiality | compHeader.confidentialityCode.code | Identify confidentiality code for resource |
attestor.mode | Constant "legal" | |
attestor.time | compHeader.legalAuthenticator.time.value | Format datetime using function formatDateTime |
attestor.party.reference | compHeader.legalAuthenticator.assignedEntity.id.extension | Use parameter practList to identify legal authenticator |
subject.reference | patientId | Id of the patient resource created from recordTarget |
encounter.reference | encounterId | Encompassing encounter id from parameters |
custodian.reference | custodianOrgId | Custodian orgId from parameters |
event.period.start | compHeader.documentationOf.serviceEvent.effectiveTime.low.value | Format datetime using function formatDateTime |
event.period.end | compHeader.documentationOf.serviceEvent.effectiveTime.high.value | Format datetime using function formatDateTime |
fun buildCompositionResource (compList, compResource, fhirConstants, practList, patientId, custodianOrgId, encompassingEncounterId, organizationsList)
Function to build composition resource. Uses createCompositionHeader function.
param
compList
is the list of sections.
paramcompResource
is the C-CDA ClinicalDocument.
paramfhirConstants
is the list of constants used for mapping.
parampractList
is the list of practitioner identifiers and IDs.
parampatientId
is the id of the patient.
paramcustodianOrgId
is the id for the Custodian organization.
paramencompassingEncounterId
is the id for the encompassing encounter if present.
paramorganizationsList
is the list of organization identifiers and IDs.
paramsectionList
is the list of sections in the C-CDA document.
return A FHIR R4 formated Composition Resource.
fun getCDASection (body, templateId)
Function to get CDA Section from C-CDA Document. Filters the input to match the templateId and returns the first section.
param
body
is the input C-CDA request's component.
paramtemplateId
is used to match the template.
return An Object with the section of the C-CDA or an empty object.
createFHIRR4Condition
This module implements functions to support creation of FHIR R4 Condition.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Condition.dwl
Functions
fun createCondition (cond, fhirProblemConstants, patientId, practList, condId)
Function to create Condition FHIR object from the input XML CDA Request. Uses getIdentifier,formatDateTime and mapCodeSystem functions from cdaToFHIRTools.
param
cond
is a object from the CDA input XML, containing Condition information.
paramfhirProblemConstants
is a list of constants to be used for mapping.
parampatientId
is the patient ID.
paramcondId
is ID for the resource.
parampractList
is a list of practitioner identifiers and IDs.
return A FHIR format Condition object.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
identifier.system | cond.id | Identifier system for resource |
identifier.value | cond.id | Identifier value for resource |
clinicalStatus.coding.code | cond.effectiveTime.high.value | Conditionally set to "active" or "resolved" |
clinicalStatus.coding.system | Constant problemClinicalStatusSystem from fhirConstants.Problem | |
code.coding.code | cond.value.code | Condition Code |
code.coding.system | cond.value.codeSystem | Use function mapCodeSystem to lookup code system name |
code.coding.display | cond.value.displayName | Condition display name |
subject.reference | patientId | Patient ID created from recordTarget |
onsetDateTime | cond.effectiveTime.low.value | Format datetime using function formatDateTime |
recordedDate | cond.author.time.value | Format datetime using function formatDateTime |
recorder.reference | cond.author.assignedAuthor.id.extension | Filter practList to get id match |
createFHIRR4Consent
This module implements functions to support creation of FHIR R4 Consent.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Consent.dwl
Functions
fun createConsent (advDirectiveArray, patientId, docId, practRefArray, fhirConsentConstants)
Function to create Consent FHIR object from the input XML CDA Request. Uses getIdentifier function from cdaToFHIRTools.
param
advDirectiveArray
is an array from the CDA input XML, containing Consent information.
paramfhirConsentConstants
is a list of constants to be used for mapping.
parampatientId
is the patient ID.
paramdocId
is the reference to DocumentReference resource.
parampractRefArray
is a list of practitioner identifiers and IDs.
return A FHIR format Consent object.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
identifier.system | advDir.id | Identifier system for resource |
identifier.value | advDir.id | Identifier value for resource |
status | advObs.effectiveTime.high | Conditionally set to "active" |
scope.coding.system | Constant consentScopeCodingSystem from fhirConstants.Consent | |
scope.coding.code | Constant consentScopeCodingCode from fhirConstants.Consent | |
category.coding.code | advDir.code.code | Consent Category Code |
category.coding.system | Constant categorySystem from fhirConstants.Consent | |
dateTime | advObs.effectiveTime.low | Format datetime using function formatDateTime |
provision.code.code | advObs.value.code | Consent provision code |
provision.code.display | advObs.value.displayName | Consent provision code name |
provision.code.system | Constant provisionCodeSystem from fhirConstants.Consent | |
subject.reference | patientId | Patient ID created from recordTarget |
sourceReference.reference | docId | Document Reference provided as parameter to the function |
performer.reference | advObs.author.assignedAuthor.id | Use function getPractitionerRef to get practitioner id |
createFHIRR4Coverage
This module implements functions to support creation of FHIR R4 Coverage.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Coverage.dwl
Functions
fun createCoverage (cov, fhirCoverageConstants, covId, patientId, payers)
Function to create Coverage FHIR object from the input XML CDA Request. Uses getIdentifier function from cdaToFHIRTools.
param
cov
is an object from the CDA input XML, containing Coverage information.
paramfhirCoverageConstants
is a list of constants to be used for mapping.
paramcovId
is the ID for the resource.
return A FHIR format Coverage object.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
identifier.system | cov.id | Identifier system for resource |
identifier.value | cov.id | Identifier value for resource |
status | cov.performer.time.high.value | Conditionally set to "active or cancelled" |
type.coding.system | Constant selfPayTypeCodeSystem from fhirConstants.Coverage | |
type.coding.code | cov.code.code | Conditionally set to "pay" |
type.coding.display | cov.code.code | Conditionally set to "PAY" |
beneficiary.reference | patientId | Patient ID created from recordTarget |
payor.reference | Payer or Org Ref | If cov.code.code is 81(SelfPay)then it is Patient Ref else Insurance Org Ref |
createFHIRR4Device
This module implements functions to support creation of FHIR R4 Device.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Device.dwl
Functions
fun createDevice (device, fhirDeviceConstants, deviceId)
Function to create Device FHIR object from the input XML CDA Request. Uses getIdentifier function from cdaToFHIRTools.
param
device
is an object from the CDA input XML, containing Device information.
paramfhirDeviceConstants
is a list of constants to be used for mapping.
paramdeviceId
is the ID for the resource.
return A FHIR format Device object.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
identifier.system | device.id | Identifier system for resource |
identifier.value | device.id | Identifier value for resource |
type.code | device.participant.participantRole.playingDevice.code.code | Device Type Code |
type.displayName | device.participant.participantRole.playingDevice.code.displayName | Device Type Code Name |
type.system | Constant deviceCodeSystem from fhirConstants.Device | |
manufacturer | device.participant.participantRole.scopingEntity.desc | Device manufacturer name |
createFHIRR4DeviceUseStatement
This module implements functions to support creation of FHIR R4 DeviceUseStatement.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4DeviceUseStatement.dwl
Functions
fun createDeviceUseStatement (supply, fhirDeviceUseConstants, supplyId, patientId)
Function to create DeviceUseStatement FHIR object from the input XML CDA Request. Uses getIdentifier function from cdaToFHIRTools.
param
supply
is an object from the CDA input XML, containing DeviceUseStatement information.
paramfhirDeviceUseConstants
is a list of constants to be used for mapping.
paramsupplyId
is the ID for the resource.
parampatientId
is the patient ID.
return A FHIR format DeviceUseStatement object.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
identifier.system | supply.id | Identifier system for resource |
identifier.value | supply.id | Identifier value for resource |
status | supply.statusCode.code | Device Use Statement Status Code |
subject.reference | patientId | Patient ID created from recordTarget |
device.coding.code | supply.participant.participantRole.playingDevice.code.code | Device Code |
device.coding.display | supply.participant.participantRole.playingDevice.code.displayName | Device Code Name |
device.coding.display | Constant deviceCodeSystem from fhirConstants.DeviceUseStatement |
createFHIRR4DiagnosticReport
This module implements functions to support creation of FHIR R4 DiagnosticReport.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4DiagnosticReport.dwl
Functions
fun diagnosticReportStatusLookup (inCode)
Function to lookup diagnostic report status.
param
inCode
is the C-CDA format code.
return A FHIR formatted code.
fun createDiagnosticReport (diagnostic, fhirDiagRepConstants, patientId, diagId, diagnosticObservationIds)
Function to create DiagnosticReport FHIR object from the input XML CDA Request. Uses getIdentifier,formatDateTime and mapCodeSystem functions from cdaToFHIRTools.
param
diagnostic
is an object from the CDA input XML, containing DiagnosticReport information.
paramfhirDiagRepConstants
is a list of constants to be used for mapping.
paramdiagId
is the ID for diagnostic report resource.
parampatientId
is the patient ID.
paramdiagnosticObservationIds
is a list of observation IDs.
return A FHIR format DiagnosticReport object.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
identifier.system | diagnostic.id | Identifier system for resource |
identifier.value | diagnostic.id | Identifier value for resource |
status | diagnostic.organizer.statusCode.code | Use function diagnosticReportStatusLookup to lookup status |
code.coding.code | diagnostic.organizer.code.code | Diagnostic Report Code |
code.coding.display | diagnostic.organizer.code.displayName | Diagnostic Report Code Name |
code.coding.system | diagnostic.organizer.code.codeSystem | Use function mapCodeSystem to lookup Diagnostic Report Code System |
effectivePeriod.start | diagnostic.organizer.effectiveTime.low.value | Format datetime using function formatDateTime |
effectivePeriod.end | diagnostic.organizer.effectiveTime.high.value | Format datetime using function formatDateTime |
effectiveDateTime | diagnostic.organizer.effectiveTime.value | Format datetime using function formatDateTime |
subject.reference | patientId | Patient ID created from recordTarget |
result.reference | diagnostic.organizer.component.observation | Filter diagnosticObservationIds to match current observation |
createFHIRR4DocumentReference
This module implements functions to support creation of FHIR R4 DocumentReference.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4DocumentReference.dwl
Functions
fun createDocumentRef (advDirective, fhirDocRefConstants)
Function to create DocumenatReference FHIR object from the input XML CDA Request.
param
advDirective
is an object from the CDA input XML, containing Documentation information.
paramfhirDocRefConstants
is a list of constants used for mapping.
return A FHIR format Encounter object.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
status | advObs.effectiveTime.high | Conditionally set to "current" |
content.attachment.contentType | advObs.reference.externalDocument.text.mediaType | Content type for Document |
content.attachment.url | advObs.reference.externalDocument.text.reference.value | URL for Document |
createFHIRR4Encounter
This module implements functions to support creation of FHIR R4 Encounter.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Encounter.dwl
Functions
fun createEncounter (encounterObj, fhirEncounterConstants, encounterId, patientId, practitioners, locations)
Function to create Encounter FHIR object from the input XML CDA Request. Uses getIdentifier function from cdaToFHIRTools.
param
encounterObj
is an object from the CDA input XML, containing Encounter information.
paramfhirEncounterConstants
is a list of constants to be used for mapping.
paramencounterId
is the ID for the resource.
parampatientId
is the patient ID.
parampractitioners
is a list of practitioner IDs and identifiers.
return A FHIR format Encounter object.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
identifier.system | encounterObj.id | Identifier system for resource |
identifier.value | encounterObj.id | Identifier value for resource |
status | Constant status from fhirConstants.Encounter | |
class.code | encounterObj.translation.code | Encounter class code |
class.display | encounterObj.translation.displayName | Encounter class code name |
class.system | encounterObj.translation.codeSystem | Encounter class code system name |
type.coding.code | encounterObj.code.code | Encounter type code |
type.coding.display | encounterObj.code.displayName | Encounter type code name |
type.coding.system | encounterObj.code.codeSystem | Encounter type code system name |
subject.reference | patientId | Patient ID created from recordTarget |
participant.type.system | Constant participantTypeSystem from fhirConstants.Encounter | |
participant.type.code | Constant participantTypeCode from fhirConstants.Encounter | |
participant.individual.reference | encounterObj.performer.assignedEntity.id.extension | Lookup practitionerId from practitioners |
location.location.reference | location.location | Map locations from location parameter |
fun createEncompassingEncounter (encounterObj, fhirEncounterConstants, encounterId, patientId, practitioners, location)
Function to create Encounter FHIR object from incoming C-CDA Request. Uses getIdentifier function from cdaToFHIRTools.
param
encounterObj
is an object from the CDA input XML, containing Encounter information.
paramfhirEncounterConstants
is a list of constants to be used for mapping.
paramencounterId
is the ID for the resource.
parampatientId
is the patient ID.
parampractitioners
is a list of practitioner ID and identifiers.
paramlocation
is the id of the location of encounter.
return A FHIR format Encounter object.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
identifier.system | encounterObj.id | Identifier system for resource |
identifier.value | encounterObj.id | Identifier value for resource |
status | Constant status from fhirConstants.Encounter | |
class.code | encounterObj.translation.code | Encounter class code |
class.display | encounterObj.translation.displayName | Encounter class code name |
class.system | encounterObj.translation.codeSystem | Encounter class code system name |
type.coding.code | encounterObj.code.code | Encounter type code |
type.coding.display | encounterObj.code.displayName | Encounter type code name |
type.coding.system | encounterObj.code.codeSystem | Encounter type code system name |
period.start | encounterObj.effectiveTime.low.value | Format datetime using function formatDateTime |
period.end | encounterObj.effectiveTime.high.value | Format datetime using function formatDateTime |
subject.reference | patientId | Patient ID created from recordTarget |
hospitalization.dischargeDisposition.code | encounterObj.dischargeDispositionCode.code | Conditionally set to "home" |
hospitalization.dischargeDisposition.display | encounterObj.dischargeDispositionCode.displayName | Conditionally set to "Home" |
hospitalization.dischargeDisposition.system | Constant dischargeDispositionCodeSystem from fhirConstants.Encounter | |
participant.type.system | Constant participantTypeSystem from fhirConstants.Encounter | |
participant.type.code | Constant participantTypeCode from fhirConstants.Encounter | |
participant.individual.reference | encounterObj.performer.assignedEntity.id.extension | Lookup practitionerId from practitioners |
location.location.reference | location.location | Map locations from location parameter |
createFHIRR4FamilyHistory
This module implements functions to support creation of FHIR R4 FamilyHistory.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4FamilyHistory.dwl
Functions
fun createFamilyHistory (history, fhirHistoryConstants, histId, patientId)
Function to create FamilyHistory FHIR object from the input XML CDA Request. Uses getIdentifier function from cdaToFHIRTools.
param
history
is an object from the CDA input XML, containing FamilyHistory information.
paramfhirHistoryConstants
is a list of constants to be used for mapping.
paramhistId
is the ID for the resource.
parampatientId
is the patient ID.
return A FHIR formatted FamilyHistory object.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
identifier.system | history.id | Identifier system for resource |
identifier.value | history.id | Identifier value for resource |
status | Constant "completed" | |
relationship.code | history.subject.relatedSubject.code.translation.code | Relationship Code to Patient |
relationship.display | history.subject.relatedSubject.code.translation.displayName | Relationship Name to Patient |
relationship.system | Constant codeSystem from fhirConstants.FamilyHistory | |
sex.code | history.subject.relatedSubject.subject.administrativeGenderCode.code | Family Member Gender Code |
sex.display | history.subject.relatedSubject.subject.administrativeGenderCode.displayName | Family Member Gender Display |
sex.system | history.subject.relatedSubject.subject.administrativeGenderCode.codeSystem | Family Member Gender Code System |
bornString | history.subject.relatedSubject.subject.birthTime.value | Family Member BirthTime |
condition.code | history.component.observation.value.code | Family Member Condition Code |
condition.display | history.component.observation.value.displayName | Family Member Condition Display |
condition.system | Constant codeSystem from fhirConstants.FamilyHistory | |
condition.contributedToDeath | Conditionally set to true if deathObservationTemplateId is found in Observation | |
condition.onsetAge.value | history.component.observation.entryRelationship.observation.value.value | Onset Age for condition |
condition.onsetAge.system | Constant unitOfMeasureSystem from fhirConstants.FamilyHistory | |
condition.onsetAge.code | history.component.observation.entryRelationship.observation.value.unit | Onset Age Condition Code |
patient.reference | patientId | Patient ID created from recordTarget |
createFHIRR4Goal
This module implements functions to support creation of FHIR R4 Goal.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Goal.dwl
Functions
fun createGoal (goal, goalId, patientId)
Function to create Goal FHIR object from the input XML CDA Request. Uses getIdentifier and formatDateTime functions from cdaToFHIRTools.
param
goal
is an object from the CDA input XML, containing Goal information.
paramgoalId
is the ID for the resource.
parampatientId
is the patient ID.
return A FHIR formatted Goal object.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
identifier.system | goal.id | Identifier system for resource |
identifier.value | goal.id | Identifier value for resource |
description.code | goal.code.code | Goal Description Code |
description.display | goal.code.displayName | Goal Description Code Name |
lifecycleStatus | goal.statusCode.code | Goal Status |
subject.reference | patientId | Patient Id created from recordTarget |
startDate | goal.effectveTime | Format datetime using function formatDateTime |
createFHIRR4Immunization
This module implements functions to support creation of FHIR R4 Immunization.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Immunization.dwl
Functions
fun createImmunization (immItem, fhirConstants, immunizationId, patientId, performers)
Creates a FHIR Immunization object with the provided C-CDA substanceAdministration item, patient ID, and performer reference. Uses getIdentifier function from cdaToFHIRTools.
param
immItem
is a substanceAdministration C-CDA object.
paramfhirConstants
is a list of constants used for mapping.
paramimmunizationId
is ID used for the resource.
parampatientId
is a String with the patient ID to use.
paramperformers
is a list of Practitioners, PractitionerRole, or Organization to use as the performer reference.
return A FHIR formatted Immunization object.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
identifier.system | immItem.id | Identifier system for resource |
identifier.value | immItem.id | Identifier value for resource |
status | immItem.statusCode.code | Use function mapImmunizationStatus to lookup status |
manufacturer | immItem.consumable.manufacturedProduct.manufacturerOrganization.id.root | Use function mapImmunizationManufacturer for mapping |
lotNumber | immItem.consumable.manufacturedProduct.manufacturedMaterial.lotNumberText | Immunization substance lot number |
vaccineCode | immItem.consumable.manufacturedProduct.manufacturedMaterial.code.code | |
patient.reference | patientId | Patient ID created from recordTarget |
performer.actor.reference | immItem.performer.assignedEntity.id.extension | Lookup performer id from input parameter performers |
occurenceString | immItem.effectiveTime.value | Format datetime using formatDateTime |
site | immItem.approachSiteCode.code | Use function mapImmunizationSite for mapping |
route | immItem.routeCode.code | Use function mapImmunizationRoute for mapping |
doseQuantity | immItem.doseQuantity.center.value | Immunization dose quantity |
note.text | immItem.text | Immunization note |
reaction | immItem | Use function mapImmunizationReaction with object detailed in the function |
fun mapImmunizationStatus (code)
Maps the immunization status code.
param
code
is a String with the C-CDA status code.
return A String with the FHIR status code.
fun mapImmunizationVaccineCode (code)
Maps the immunization vaccine code.
param
code
is a String with the C-CDA vaccine code.
return A CodeableConcept object with the FHIR formatted code.
fun getImmunizationCvxDisplay (code)
Maps the CVX immunization vaccine code provided to a display string.
param
code
is a String with the CVX immunization vaccine code.
return A String with the display or blank if not matched.
fun getImmunizationOidDisplay (code)
Maps the OID immunization vaccine code provided to a display string.
param
code
is a String with the OID immunization vaccine code.
return A String with the display or blank if not matched.
fun mapImmunizationManufacturer (id)
Maps the immunization manufacturer ID to an organization reference.
param
id
is a String with the organization ID.
return A FHIR formatted Organization object reference.
fun mapImmunizationSite (code)
Maps the immunization site code to the FHIR formatted site CodeableConcept object.
param
code
is a String with the code to map.
return A CodeableConcept object with the site code or null if not matched.
fun mapImmunizationRoute (code)
Map the immunization route code to the FHIR formatted CodeableConcept object.
param
code
is a String with the route code.
return A CodeableConcept object with the route code or null if not matched.
fun mapImmunizationReaction (item)
Maps the immunization item to the FHIR formatted immunization reaction list.
param
item
is a substanceAdministration object to map from.
return A FHIR formatted reaction list, or null if not found.
fun mapImmunizationGetReactionObs (item)
Gets the list of reaction observations with the provided substanceAdministration object.
param
item
is a substanceAdministration object.
return A list of reactions observations.
createFHIRR4Location
This module implements functions to support creation of FHIR R4 Location.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Location.dwl
Functions
fun createLocation (location, fhirLocationsConstants, locId)
Function to create Location FHIR object from the input XML CDA Request.
param
location
is an object from the CDA input XML, containing Location information.
paramfhirLocationsConstants
is a list of constants to be used for mapping.
paramlocId
is the ID for location resource.
return A FHIR formatted MedicationDispense object.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
name | location.playingEntity.name | Location Name |
address.line | location.addr.streetAddressLine | Location Address Line |
address.city | location.addr.city | Location Address City |
address.state | location.addr.state | Location Address State |
address.country | location.addr.country | Location Address Country |
address.postalCode | location.addr.postalCode | Location Address Postal Code |
telecom.system | Constant "phone" | |
telecom.value | location.telecom.value | Location's communication number |
telecom.use | Conditionally set to phoneUse from fhirConstants.Location | |
type.code | location.code.code | Location Type Code |
type.system | location.code.codeSystem | Location Type Code System |
type.display | location.code.displayName | Location Type Name |
createFHIRR4Medication
This module implements functions to support creation of FHIR R4 Medication.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Medication.dwl
Functions
fun createMedication (med, fhirConstants, medId)
Function to create Medication FHIR object from the input XML CDA Request with parameters medicationObject, organizationId. Uses getIdentifier function from cdaToFHIRTools.
param
med
is an object from the CDA input XML, containing Medication information.
paramfhirConstants
is a list of constants used for mapping.
parammedId
is the ID used for resource.
return A FHIR format Medication object.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
code.code | med.consumable.manufacturedProduct.manufacturedMaterial.code.code | Medication Code |
code.display | med.consumable.manufacturedProduct.manufacturedMaterial.code.displayName | Medication Name |
code.system | Constant medicationCodeSystem from fhirConstants.Medication |
createFHIRR4MedicationAdministration
This module implements functions to support creation of FHIR R4 MedicationAdministration.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4MedicationAdministration.dwl
Functions
fun createMedicationAdministration (medAdmn, fhirMedAdmnConstants, patientId, medAdmnId, dischargeMedicationId)
Function to create MedicationAdministration FHIR object from the input XML CDA Request. Uses functions getIdentifier,formatDateTime,medAdmnStatusLookup from cdaToFHIRTools.
param
medAdnm
is the C-CDA medication administration resource.
paramfhirMedAdmnConstants
is a list of constants for mapping.
parampatientId
is a reference to a Patient.
parammedAdmnId
is the id for MedicationAdministration.
paramdischargeMedicationId
is the discharge medication id.
return - FHIR formatted MedicationAdministration object.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
identifier.system | medAdmn.id | Identifier system for resource |
identifier.value | medAdmn.id | Identifier value for resource |
status | medAdmn.statusCode.code | Use function medAdmnStatusLookup to lookup status |
effectivePeriod.start | medAdmn.effectiveTime.low.value | Format datetime using function formatDateTime |
effectivePeriod.end | medAdmn.effectiveTime.high.value | Format datetime using function formatDateTime |
medicationReference.reference | dischargeMedicationId | Map the input parameter as a reference |
subject.reference | patientId | Patient ID created from recordTarget |
dosage.route.coding.system | Constant dosageRouteCodeSystem from fhirConstants.MedicationAdminstration | |
dosage.route.coding.code | medAdmn.routeCode.code | Medication Administration route code |
dosage.route.coding.display | medAdmn.routeCode.displayName | Medication Administration route Code Name |
dosage.dose.value | medAdmn.doseQuantity.value | Medication Adminstration Dose Quantity |
dosage.rateQuantity.value | medAdmn.rateQuantity.value | Medication Adminstration Dosage Rate Quantity |
createFHIRR4MedicationDispense
This module implements functions to support creation of FHIR R4 MedicationDispense.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4MedicationDispense.dwl
Functions
fun createMedicationDispense (medDisp, fhirMedDispConstants, patientId, medDispId, medicationRequests, practitioners)
Function to create MedicationDispense FHIR object from the input XML CDA Request.
param
medDisp
is an object from the CDA input XML, containing MedicationDispense information.
paramfhirMedDispConstants
is a list of constants to be used for mapping.
parampatientId
is a reference to a Patient.
parammedDispId
is the ID for medication dispense resource.
parammedicationRequests
is a list of medication requests.
parampractitioners
is a list of practitioner identifier and IDs.
return A FHIR formatted MedicationDispense object.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
identifier.system | medDisp.id | Identifier system for resource |
identifier.value | medDisp.id | Identifier value for resource |
intent | Constant set to "order" | |
status | medDisp.statusCode.code | Medication Dispense status |
whenPrepared | medDisp.effectiveTime.low.value | Medication dispense prepared |
whenHandedOver | medDisp.effectiveTime.high.value | Medication dispense handed over |
quantity.value | medDisp.quantity.value | Medication dispensed quantity |
subject.reference | patientId | Patient ID created from recordTarget |
medication.code | medDisp.product.manufacturedProduct.manufacturedMaterial.code.code | Medication code |
medication.system | Constant medicationCodeSystem from fhirConstants.MedicationDispense | |
medication.display | medDisp.product.manufacturedProduct.manufacturedMaterial.code.displayName | Medication display name |
performer.actor.reference | performer.assignedEntity.id.extension | Use parameter practitioners to filter for practitioner id |
authorizingPrescription.reference | Use function getMedReferenceId and parameter medicationRequests to filter medicationRequestId |
fun createDischargeMedicationDispense (medDisp, patientId, medDispId, medicationId, practitionerId)
Function to create DischargeMedicationDispense FHIR object from incoming C-CDA Request.
param
medDisp
is an object from the CDA input XML, containing MedicationDispense information.
parampatientId
is a reference to a Patient.
parammedDispId
is the ID for medication dispense resource.
parammedicationRequests
is a list of medication requests.
parampractitioners
is a list of practitioner identifiers and IDs.
return A FHIR formatted MedicationDispense object.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
identifier.system | resource.id | Identifier system for resource |
identifier.value | resource.id | Identifier value for resource |
intent | Constant set to "order" | |
status | resource.statusCode.code | Medication Dispense status |
whenPrepared | resource.effectiveTime.low.value | Medication dispense prepared |
whenHandedOver | resource.effectiveTime.high.value | Medication dispense handed over |
quantity.value | resource.quantity.value | Medication dispensed quantity |
subject.reference | patientId | Patient ID created from recordTarget |
medication.reference.reference | medicationId | Medication reference id |
performer.actor.reference | performer.assignedEntity.id.extension | Practitioner reference for medication dispense |
createFHIRR4MedicationRequest
This module implements functions to support creation of FHIR R4 MedicationRequest.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4MedicationRequest.dwl
Functions
fun createMedicationRequest (medicationRequest, fhirMedReqConstants, patientId, medReqId, practitioners)
Function to create MedicationRequest FHIR object from the input XML CDA Request.
param
medicationRequest
is an object from the CDA input XML, containing MedicationRequest information.
paramfhirMedReqConstants
is a list of constants used for mapping.
parampatientId
is a reference to a Patient.
parammedReqId
is ID for medication request.
parampractitioners
is a list of practitioner identifier and IDs.
return A FHIR formatted MedicationRequest object.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
identifier.system | medicationRequest.id | Identifier system for resource |
identifier.value | medicationRequest.id | Identifier value for resource |
intent | Constant set to "order" | |
status | medicationRequest.statusCode.code | Medication request status |
subject.reference | patientId | Patient ID created from recordTarget |
medicationCodeableConcept.system | Constant medicationCodeSystem from fhirConstants.MedicationRequest | |
medicationCodeableConcept.code | medicationRequest.product.manufacturedProduct.manufacturedMaterial.code.code | Medication Code |
medicationCodeableConcept.display | medicationRequest.product.manufacturedProduct.manufacturedMaterial.code.displayName | Medication Name |
medicationCodeableConcept.text | medicationRequest.product.manufacturedProduct.manufacturedMaterial.code.displayName | Medication Text Name |
requester.reference | author.assignedAuthor.id.extension | Filter practitioners using the C-CDA element and get the ID from the array |
createFHIRR4MedicationStatement
This module implements functions to support creation of FHIR R4 MedicationStatement.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4MedicationStatement.dwl
Functions
fun createMedicationStatement (medState, fhirMedStateConstants, medStateId, medReq, medDispense, patientId)
Function to create MedicationStatement FHIR object from the input XML CDA Request.
param
medState
is an object from the CDA input XML, containing MedicationStatement information.
paramfhirMedStateConsants
is a set of constants used.
parammedStateId
is a reference to a MedicationDispense.
parammedReq
is a list of medication requests.
parammedDispense
is a list of medication dispense.
parampatientId
is a reference to a Patient.
return A FHIR format MedicationStatement object.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
identifier.system | medState.id | Identifier system for resource |
identifier.value | medState.id | Identifier value for resource |
basedOn | Function getMedReferenceId helps fetch reference for MedicationRequest | |
partOf | Function getMedReferenceId helps fetch reference for MedicationDispense | |
status | medState.statusCode.code | Conditionally mapped to "stopped" |
medicationCodeableConcept.code | medState.consumable.manufacturedProduct.manufacturedMaterial.code.code | Medication Code |
medicationCodeableConcept.system | Constant medicationCodeSystem from fhirConstants.MedicationStatement | |
medicationCodeableConcept.display | medState.consumable.manufacturedProduct.manufacturedMaterial.code.displayName | Medication Name |
subject.reference | patientId | Patient ID created from recordTarget |
effectiveDateTime | medState.effectiveTime.low.value | Format datetime using formatDateTime function filtered for dataType IVL_TS |
dosage.timing.repeat.frequency | medState.effectiveTime.period.value | Filter for frequency using dataType PIVL_TS |
dosage.timing.repeat.period | Constant of "1" and can be modify as desired | |
dosage.timing.repeat.periodUnit | medState.effectiveTime.period.unit | TimePeriod Unit |
dosage.doseAndRate.code | medState.effectiveTime.institutionSpecified | Conditionally set to "calculated" |
dosage.doseAndRate.system | Constant value | |
dosage.doseQuantity.value | medState.doseQuantity.value | Medication quantity |
dosage.doseQuantity.unit | medState.doseQuantity.unit | Medication quantity units |
dosage.route.code | medState.routeCode.code | Dosage route code |
dosage.route.system | medState.routeCode.codeSystem | Dosage route code system |
dosage.route.display | medState.routeCode.dispalyName | Dosage route display |
createFHIRR4Observation
This module implements functions to support creation of FHIR R4 Observation.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Observation.dwl
Functions
fun createObservation (observation, patientId, fhirObsrvConstants, obsrvId, practitionersList)
Function to create FHIR R4 Observation from CDA input XML request. Uses getIdentifier,createObservationValue,formatDateTime,ObservationStatusLookup,mapCodeSystem and mapObservationInterpretationSystem functions from cdaToFHIRTools.
param
observation
is a resource of C-CDA Observation type.
parampatientId
is the ID of the Patient resource.
paramfhirObsrvConstants
is the list of constants used.
paramobsrvId
is the ID to be used for creating the resource.
return A FHIR format Observation resource.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
identifier.system | observation.id | Identifier system for resource |
identifier.value | observation.id | Identifier value for resource |
category.system | Constant categorySystem from fhirConstants.Observation | |
category.code | Constant categoryCode from fhirConstants.Observation | |
status | observation.statusCode.code | Lookup code using function ObservationStatusLookup |
code.code | resorce.code.code | Trim value for Observation code |
code.display | resorce.code.displayName | Observation Code Name |
code.system | resorce.code.codeSystem | Lookup codesystem using function mapCodeSystem |
effectivePeriod.start | observation.effectiveTime.low.value | Format datetime using function formatDateTime |
effectivePeriod.end | observation.effectiveTime.high.value | Format datetime using function formatDateTime |
effectiveDateTime | observation.effectiveTime.value | Format datetime using function formatDateTime |
value | Function createObservationValue maps either a CodeableConcept or an object | |
range | Function createObservationRange maps reference ranges for observation | |
interpretation.code | interpretationCode.code | Observation interpretation code |
interpretation.system | interpretationCode.codeSystem | Lookup codeSystem using mapObservationInterpretationSystem |
bodySite.code | observation.targetSiteCode.code | Body Site code |
bodySite.system | Constant bodySiteSystem from fhirConstants.Observation | |
subject.reference | patientId | Patient ID created from recordTarget |
fun createObservationValue (inValue)
Function to create value for US Core Observation using CDA C-CDA XML value.
param
inValue
is the XML complex type for value in C-CDA.
return Either a valueCodeableConcept or value quantity type.
fun createObservationRange (inValue)
Function to create ObservationRange for US Core Observation using C-CDA XML value.
param
inValue
is the XML complex type for value in C-CDA.
return a referenceRange element
fun mapObservationInterpretationSystem (sys)
Maps the Observation interpretation system.
param
code
is a String with the C-CDA system code.
return A String with the FHIR uri.
fun ObservationStatusLookup (incode)
Function to convert C-CDA observation status to US Core Observation status.
param
incode
is the input observation status in C-CDA format.
return A FHIR format status code equivalent.
createFHIRR4Organization
This module implements functions to support creation of FHIR R4 Organization.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Organization.dwl
Functions
fun createOrganization (org, fhirOrgConstants, orgId)
Function to create FHIR R4 Organization from CDA input XML request. Uses getIdentifier functions from cdaToFHIRTools.
param
org
is a resource of C-CDA Organization type.
paramfhirOrgConstants
is the list of constants used.
paramorgId
is the ID to be used for creating the resource.
return A FHIR format Observation resource.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
identifier.system | org.id | Identifier system for resource |
identifier.value | org.id | Identifier value for resource |
name | org.name | Org name |
address.use | Constant "work" | |
address.line | org.addr.streetAddressLine | Org Address Line |
address.city | org.addr.city | Org Address City |
address.state | org.addr.state | Org Address State |
address.postalCode | org.addr.postalCode | Org Address Postal Code |
address.country | org.addr.country | Org Address Country |
telecom.system | Constant telecomSystem from fhirConstants.Organization | |
telecom.value | org.telecom.value | Org's communication number |
telecom.use | Conditionally set to "work" |
createFHIRR4Patient
This module implements functions to support creation of FHIR R4 Patient.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Patient.dwl
Functions
fun createPatient (patientRole, fhirPatientConstants, birthSex, patientId)
Function to create FHIR R4 Patient from CDA input XML request with parameters patientRole, fhirPatientConstants,birthSex.
param
patientRole
is an object from the CDA input XML under recordTarget, containing patient information.
paramfhirPatientConstants
is a list of constants used for creating patient resource.
parambirthSex
is the assigned sex at birth of the patient. Generated from CCD's Social History template.
parampatientId
is the ID to be used for Patient resource.
return A FHIR formatted Patient object.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
extension.valueCoding.system | Constant ombRaceCategorySystem from fhirConstants.Patient | |
extension.valueCoding.code | patientRole.patient.raceCode.code | Patient's race code |
extension.valueCoding.display | patientRole.patient.raceCode.displayName | Patient's race name |
extension.url | Constant raceCategoryText from fhirConstants.Patient | |
extension.valueString | patientRole.patient.raceCode.displayName | |
url | Constant ombRaceUrl from fhirConstants.Patient | |
identifier.type.system | Constant identifierSystem from fhirConstants.Patient | |
identifier.type.code | Constant identifierCode from fhirConstants.Patient | |
identifier.value | patientRole.id.extension | Patient Identifier |
identifier.system | Constant identifierValueSystem from fhirConstants.Patient | |
active | Constant "true" | |
name.use | Conditionally "usual" or "maiden" or "else" | |
name.family | patientRole.patient.name.family | Patient's family name |
name.family | patientRole.patient.name.given | Patient's given name |
birthDate | patientRole.patient.birthTime.value | Format datetime using function formatDateTime |
telecom.system | Constant telecomPhone from fhirConstants.Patient | |
telecom.value | patientRole.patient.telecom.phone.value | Patient's phone number |
telecom.use | patientRole.patient.telecom.phone.use | Lookup phone use type using function homePhoneTypeLookup |
gender | patientRole.patient.administrativeGenderCode.code | Lookup gender code using function genderLookup |
address.use | Constant addressUse if patient address is of type homePhoneType | |
address.type | Constant addressType if patient address is of type homePhoneType | |
address.line | patientRole.addr.streetAddressLine | Patient's street address |
address.city | patientRole.addr.city | Patient's Address city |
address.state | patientRole.addr.state | Patient's Address state |
address.postalCode | patientRole.addr.postalCode | Patient's Address postalCode |
address.country | patientRole.addr.country | Patient's Address country |
maritalStauts.coding.system | Constant maritalStatusSystem from fhirConstants.Patient | |
maritalStauts.coding.code | patientRole.patient.maritalStatusCode.code | Patient's marital status code |
maritalStauts.coding.display | patientRole.patient.maritalStatusCode.displayName | Patient's marital status display |
contact.relationship.coding.system | Constant contactRelationshipSystem from fhirConstants.Patient | |
contact.relationship.coding.code | patientRole.patient.guardian.code.code | Conditionally set to "C" or "N" |
contact.relationship.coding.display | Conditionally set to "Emergency Contact" or "Next-of-Kin" | |
contact.name.use | Constant nameUse from fhirConstants.Patient | |
contact.name.family | patientRole.patient.guardian.contact.guardianPerson.name.family | Guardian's family name |
contact.name.given | patientRole.patient.guardian.contact.guardianPerson.name.given | Guardian's given name |
contact.telecom.system | Constant telecomPhone from fhirConstants.Patient | |
contact.telecom.value | patientRole.patient.guardian.contact.telecom.value | Guardian's phone number |
communication.language.coding.system | Constant communicationLangaugeSystem from fhirConstants.Patient | |
communication.language.coding.code | patientRole.patient.languageCommunication.languageCode.code | Patient's language of communication |
communication.preferred | patientRole.patient.languageCommunication.preferenceInd.value | Conditionally true or false based on the C-CDA element |
createFHIRR4Practitioner
This module implements functions to support creation of FHIR R4 Practitioner.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Practitioner.dwl
Functions
fun createPractitioner (pract, fhirPractConstants, practId)
Function to create FHIR R4 Practitioner from CDA input XML request. Uses getIdentifier functions from cdaToFHIRTools.
param
pract
is a resource of C-CDA Practitioner type.
paramfhirPractConstants
is the list of constants used.
parampractId
is the ID to be used for creating the resource.
return A FHIR format Practitioner resource.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
identifier.system | pract.id | Identifier system for resource |
identifier.value | pract.id | Identifier value for resource |
name.family | pract.assignedPerson.name.family | Practitioner family name |
name.given | pract.assignedPerson.name.*given | Practitioner given name |
name.prefix | pract.assignedPerson.name.*prefix | Practitioner prefix |
name.suffix | pract.assignedPerson.name.*suffix | Practitioner suffix |
name.suffix | pract.assignedPerson.name.*suffix | Practitioner suffix |
address.line | pract.addr.streetAddressLine | Practitioner's Address Line |
address.city | pract.addr.city | Practitioner's Address City |
address.state | pract.addr.state | Practitioner's Address State |
address.postalCode | pract.addr.postalCode | Practitioner's Address Postal Code |
address.country | pract.addr.country | Practitioner's Address Country |
telecom.system | Constant telecomSystem from fhirConstants's Practitioner | |
telecom.value | pract.telecom.value | Practitioner's communication number |
telecom.use | pract.telecom.use | Communication number type |
qualification.code | pract.code.code | Practitioner's Qualification Code |
qualification.display | pract.code.displayName | Practitioner's Qualification display name |
qualification.system | Practitioner's Qualification System from fhirConstants's Practitioner |
fun buildPractitioners (practitioners, fhirPractConstants)
Function to create a list of FHIR R4 practitioners using input C-CDA's informants, author, legalAuthenticator. Uses createPractitioner from dwl.fhirUtil.
param
practitioners
is the list of practitioners in C-CDA format.
paramfhirPractConstants
is a list of constants used for creating Practitioners.
return An array of FHIR R4 formated Practitioners.
fun buildPractitionersforRef (performers, practList, fhirPractConstants)
Function to build FHIR R4 Practitioners from Planned Procedures.
param
performers
a list of authors for planned procedure.
parampractList
is the list of informant practitioners from Header.
return An array of FHIR R4 Practitioners List.
fun buildPractRefList (perfList, practList)
Function to build a reference list of practitioners for Planned Procedure Service Request creation.
param
perfList
a list of authors for planned procedure.
parampractList
is the list of informant practitioners from Header.
return An array of id and identfiers of practitioners
fun getPractitionerRef (practList, authorId)
Function to fetch practitioner id from list.
param
practList
is a list of practitioner's IDs and Identifiers.
paramauthorId
is the id to use for matching.
return A reference if a match is found else null.
createFHIRR4Procedure
This module implements functions to support creation of FHIR R4 Procedure.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4Procedure.dwl
Functions
fun getPerformerRefs (perfList, procRefType, refIdent)
Function to create performer reference.
param
perfList
is the list of practitioners created.
paramprocRefType
is a literal with either "Organization" or "Practitioner" for creating reference.
paramrefIdent
is the identifier value to be used for lookup perfList's ID.
return A reference of type Organization or Practitioner.
fun createProcedure (proc, fhirProcConstants, patientId, procId, perfList, procType)
Function to create FHIR R4 Procedure from CDA input XML request. Uses formatDateTime,getIdentifier functions from cdaToFHIRTools.
param
proc
is the procedure component.
paramfhirProcPersonConstants
is the list of constants used to create related person FHIR resource.
parampatientId
is used as reference to patient in the related person resource.
paramprocId
is the ID to be used for creating the resource.
paramperfList
is the list of practitioners.
paramprocType
is a literal that identifies a Planned procedure vs a performed procedure.
return A FHIR format Procedure resource.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
identifier.system | proc.id | Identifier system for resource |
identifier.value | proc.id | Identifier value for resource |
state | proc.statusCode.code | Conditionally set to "preparation" |
code.code | proc.code.code | Procedure Code |
code.display | proc.code.displayName | Procedure Name |
code.system | Constant codeSystem from fhirConstants.Procedure | |
performedDateTime | proc.effectiveTime.value | Format datetime using function formatDateTime |
bodySite.code | proc.targetSiteCode.code | Procedure body site code |
bodySite.display | proc.targetSiteCode.displayName | Procedure body site name |
bodySite.system | Constant bodySiteSystem from fhirConstants.Procedure | |
subject.reference | patientId | Patient Id created from recordTarget |
performer.reference | proc.author.assignedAuthor.id or performer.assignedEntity.representedOrganization.id | Use function getPerformerRefs to fetch reference |
createFHIRR4RelatedPerson
This module implements Create RelatedPersons for C-CDA to FHIR conversion.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4RelatedPerson.dwl
Functions
fun createRelatedPerson (relatedPerson, fhirRelatedPersonConstants, patientId, relPerId)
Function to create FHIR R4 RelatedPerson from CDA input XML request. Uses relationshipLookup and addressUseLookup functions from cdaToFhirTools library.
param
relatedPerson
is the relatedPerson component.
paramfhirRelatedPersonConstants
is the list of constants used to create related person FHIR resource.
parampatientId
is used as reference to patient in the related person resource.
paramrelPerId
is the ID to be used for creating the resource .
return An array of FHIR formatted relatedPerson array.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
identifier.system | relatedPerson.id | Identifier system for resource |
identifier.value | relatedPerson.id | Identifier value for resource |
patient.reference | patientId | Patient Id created from recordTarget |
relationship.system | Constant relationshipSystem from fhirConstants.RelatedPerson | |
relationship.code | relatedPerson.associatedEntity.classCode | Lookup using function relationshipLookup |
active | Constant value "true" | |
name.family | relatedPerson.associatedEntity.associatedPerson.name.family | RelatedPerson family name |
name.given | relatedPerson.associatedEntity.associatedPerson.name.given | RelatedPerson given name |
name.use | Constant nameUse from fhirConstants.RelatedPerson | |
telecom.system | Constant telecomSystem from fhirConstants.RelatedPerson | |
telecom.value | relatedPerson.associatedEntity.telecom.value | RelatedPerson's communication number |
telecom.use | Conditionally set to telecomUse from fhirConstants.RelatedPerson | |
address.use | relatedPerson.associatedEntity.addr.use | Lookup using function addressUseLookup |
address.type | Conditionally set to addressType from fhirConstants.RelatedPerson | |
address.line | relatedPerson.associatedEntity.addr.streetAddressLine | RelatedPerson's Address Line |
address.city | relatedPerson.associatedEntity.addr.city | RelatedPerson's Address City |
address.state | relatedPerson.associatedEntity.addr.state | RelatedPerson's Address State |
address.postalCode | relatedPerson.associatedEntity.addr.postalCode | RelatedPerson's Address Postal Code |
address.country | relatedPerson.associatedEntity.addr.country | RelatedPerson's Address Country |
createFHIRR4ServiceRequest
This module implements functions to support creation of FHIR R4 ServiceRequest.
Source:
.src/main/resources/dwl/fhirUtil/createFHIRR4ServiceRequest.dwl
Functions
fun createServiceRequest (servReq, servReqId, patientId, fhirServReqConstants, practList)
Function to create ServiceRequest FHIR object from incoming C-CDA Request. Uses getIdentifier,formatDateTime,servReqStatusLookup,mapCodeSystem function from cdaToFHIRTools and getPractitionerRef.
param
servReq
is an object from the CDA input XML, containing ServiceRequest information.
paramfhirServReqConstants
is a list of constants to be used for mapping.
paramservReqId
is the ID for the resource.
parampatientId
is the patient ID.
return A FHIR formatted ServiceRequest object.
FHIR R4 Element Name | C-CDA Element Name | Mapping Description |
---|---|---|
id | Id generated using uuid() for resource | |
identifier.system | servReq.id | Identifier system for resource |
identifier.value | servReq.id | Identifier value for resource |
status | servReq.statusCode.code | Lookup statusCode using function servReqStatusLookup |
occurrenceDateTime | servReq.effectiveTime.value | Format datetime using function formatDateTime |
intent | Constant value "proposal" and can update as needed | |
code.system | servReq.code.codeSystem | Convert codeSystem using function mapCodeSystem |
code.code | servReq.code.code | Service Request Code |
code.display | servReq.code.displayName | Display Name for Service Request code |
subject.reference | patientId | PatientId from recordTarget |
authoredOn | servReq.author.time.value | Format datetime using function formatDateTime |
author.reference | servReq.author.assignedAuthor.id.extension | Use function getPractitionerRef for lookup |